package com.lightdz.tshirtdz.controller;

import com.lightdz.tshirtdz.bll.FavoriteBll;
import com.lightdz.tshirtdz.model.api.ApiResponse;
import com.lightdz.tshirtdz.model.api.ApiShoppingCar;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ Description：收藏
 * @ Author     ：zbl
 * @ Date       ：Created in 16:39 09/08/2018
 * @ Modified By：
 */

@RequestMapping(value = "/favorite")
@RestController
public class FavoriteController {

    @Autowired
    FavoriteBll favoriteBll;

    /**
     * 设置收藏
     *
     * @param isFav 是否收藏
     */
    @GetMapping(value = "/setfavorite")
    public ApiResponse<Boolean> setFavorite(String wxId, long pid, boolean isFav) {
        return favoriteBll.setFavorite(wxId, pid, isFav);
    }

    /**
     * 获取我的收藏列表
     *
     * @param wxId
     * @return
     */
    @GetMapping(value = "/getfavlist")
    public ApiResponse<List<ApiShoppingCar>> getFavList(String wxId) {
        return favoriteBll.getFavList(wxId);
    }
}
